package com.ler.yrmall.order.controller;

import com.ler.yrmall.basic.Form;
import com.ler.yrmall.basic.Result;
import com.ler.yrmall.order.form.ReturnApplyForm;
import com.ler.yrmall.order.service.OrderReturnApplyService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


/**
 * @author leron
 */
@RestController
@RequestMapping("/returnApply")
public class OrderReturnApplyController {
    
    @Resource
    private OrderReturnApplyService orderReturnApplyService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public Result<?> list(Form request) {
        return Result.ok(orderReturnApplyService.find(request));
    }

    @RequestMapping("/pass/{refundId}")
    public Result<?> pass(@PathVariable Long refundId) {
        orderReturnApplyService.pass(refundId);
        return Result.ok();
    }

    @PostMapping("/apply")
    public Result<?> apply(@RequestBody ReturnApplyForm request) {
        orderReturnApplyService.apply(request);
        return Result.ok();
    }

}
